#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstring>
using namespace std;
const int N = 110, M = N * N;
int h[N], e[M], ne[M], idx;
int q[N], din[N];
int n;
void add(int a, int b)
{
    e[idx] = b, ne[idx] = h[a], h[a] = idx++;
}
void topsort()
{
    int hh = 0, tt = -1;
    for (int i = 1; i <= n; i++)
    {
        if (din[i] == 0) q[++tt] = i;
    }
    while (hh <= tt)
    {
        int t = q[hh++];
        for (int i = h[t]; ~i; i = ne[i])
        {
            int j = e[i];
            if (--din[j] == 0) q[++tt] = j;
        }
    }
}
int main()
{
    cin >> n;
    memset(h, -1, sizeof h);
    for (int i = 1; i <= n; i++)
    {
        int son = 0;
        while (cin >> son, son)
        {
            add(i, son);
            din[son]++;
        }
    }
    topsort();
    for (int i = 0; i < n; i++) cout << q[i] << " ";
    return 0;
}